package com.jdjc.subject.common.enums;

import lombok.Getter;

/**
 * 题目点赞枚举
 */
@Getter
public enum SubjectLikedStatusTypeEnum {
    LIKED(1,"点赞"),
    UN_LIKED(0,"取消点赞");

    public int code;
    public String desc;

    SubjectLikedStatusTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据传入的整型代码值 codeVal 查找并返回对应的枚举值。
     *
     * @param codeVal
     * @return
     */
    public static SubjectLikedStatusTypeEnum getByCode(int codeVal) {
        for (SubjectLikedStatusTypeEnum resultCodeEnum : SubjectLikedStatusTypeEnum.values()) {
            if (resultCodeEnum.code == codeVal) {
                return resultCodeEnum;
            }
        }
        return null;
    }
}
